import discount.*;

/**
 *
 * @author lty
 */
public class DiscountContext {
    private DiscountStrategy discountStrategy;

    public DiscountContext(String level) {
        if (level.equals("普通会员")) {
            discountStrategy = new NormalMemberStrategy();
        } else if (level.equals("白银会员")) {
            discountStrategy = new SilverMemberStrategy();
        } else if (level.equals("黄金会员")) {
            discountStrategy = new GoldMemberStrategy();
        } else if (level.equals("钻石会员")) {
            discountStrategy = new DiamondMemberStrategy();
        }
    }

    public double calculateDiscount(double price) {
        return discountStrategy.calculateDiscount(price);
    }
}
